<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../include/laypublic.jsp"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>中南·建投-PM管理平台</title>

 <script type="text/javascript">
	function refreshCaptcha() {
		document.getElementById('LAY-user-get-vercode').src ='${ctx}/Kaptcha?' + Math.floor(Math.random() * 100);
	}
	
	if (!(window.parent == window)){
		window.parent.location.href = self.location.href;
	}
	
	function laySubmit(){
		var form = document.getElementById("loginForm");
		if (form.username.value.length == 0 || form.username.value == "") {
			layer.msg('用户名必填！',{icon: 7});
			return false;
		}
		if (form.password.value.length == 0 || form.password.value == "") {
			layer.msg('密码必填！',{icon: 7});
			return false;
		}
		if (form.captcha.value.length == 0 || form.captcha.value == "") {
			layer.msg('验证码必填！',{icon: 7});
			return false;
		}
		if (form.captcha.value.length <4 ) {
			layer.msg('验证码为4位！',{icon: 7});
			return false;
		}
		return true;
	}
	
	function loginMsg(){
		if ('${shiroLoginFailure}' != "" && '${shiroLoginFailure}' != null) {
			layer.msg('${shiroLoginFailure}',{icon: 2});
		}
	}
	
	<%-- 如果是已登录 则直接跳转到首页 --%>
	<shiro:user>
	window.location.href="${ctx}/mgr/main";
	</shiro:user>
	
</script> 
</head>	
<body onload="loginMsg()" style="background-color:#D9D9D9;">
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
    <div class="layadmin-user-login-main" style="background-color:white;border-radius:8px">
      <div class="layadmin-user-login-box layadmin-user-login-header" style="margin-top:15%;">
        <h2 style="color:#009688;font-family:Microsoft YaHei;top:15px;letter-spacing:4px">中南建投</h2>
        <p style="color:#B5B5B5">------ PM管理平台 ------</p>
      </div>
      <form id="loginForm" method="post" class="layadmin-user-login-box layadmin-user-login-body layui-form">
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
          <input type="text" name="username"  id="LAY-user-login-username"  placeholder="用户名" class="layui-input">
        </div>
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
          <input type="password" name="password" id="LAY-user-login-password"  placeholder="密　码" class="layui-input">
        </div>
        <div class="layui-form-item">
          <div class="layui-row">
            <div class="layui-col-xs7">
              <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
              <input type="text" name="captcha" id="LAY-user-login-vercode" autocomplete="off" placeholder="验证码" class="layui-input" maxLength="4">
            </div>
            <div class="layui-col-xs5">
              <div style="margin-left: 10px;">
             	<img class="layadmin-user-login-codeimg" id="LAY-user-get-vercode" src="${ctx}/Kaptcha" height="38" onclick="refreshCaptcha();" />
              </div>
            </div>
          </div>
        </div>
        <div class="layui-form-item" style="margin-bottom: 20px;">
        </div>
        <div class="layui-form-item">
          <input class="layui-btn layui-btn-fluid " type="submit" value="登 　入" onclick="return laySubmit();"/>	
        </div>
      </form>
    </div>
    <div class="layui-trans layadmin-user-login-footer">
      <p>技术支持：<a href="#" target="_blank">智链科技</a></p>
    </div>
  </div>
  <script>
	  layui.config({
	    base: '${ctx}/resources/layuiadmin/' //静态资源所在路径
	  }).extend({
	    index: 'lib/index' //主入口模块
	  }).use(['index']);
  </script>
</body>
</html>